public class Offer46 {
    public int translateNum(int num) {
        String numStr = String.valueOf(num);
        if (numStr.length()==0||numStr.length()==1) return 1;
        int length = numStr.length();
        int[] dp = new int[3];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i <= length; i++) {
            String temp = numStr.substring(i - 2, i);
            if (temp.compareTo("10")>=0 && temp.compareTo("25")<=0) dp[i%3] = dp[(i-1)%3]+dp[(i-2)%3];
            else dp[i%3] = dp[(i-1)%3];
        }
        return dp[(length)%3];

    }


}
